<!DOCTYPE html>
<html>
<head>
    <title>微信消息推送占位符表</title>
    <#include "/header.html">
</head>
<body>
<style>
    th {
        text-align: center;
    }
</style>
<div id="rrapp" v-cloak>
    <div v-show="showList">
        <div class="grid-btn">
<!--            <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>-->
            <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
<!--            <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>-->
        </div>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <div v-show="!showList" class="panel panel-default">
        <div class="panel-heading">{{title}}</div>
        <form class="form-horizontal">
<!--            <div class="form-group">-->
<!--                <div class="col-sm-2 control-label">公众号标识</div>-->
<!--                <div class="col-sm-10">-->
<!--                    <select id="gzhCode" class="form-control" v-model="bMessageDict.gzhCode">-->
<!--                        <option value="-1" selected>全部平台</option>-->
<!--                    </select>-->
<!--                </div>-->
<!--            </div>-->
            <div class="form-group">
                <div class="col-sm-2 control-label">消息推送类型</div>
                <div class="col-sm-10">
                    <label class="radio-inline">
                        <input type="radio" name="dictType" value="0" v-model="bMessageDict.dictType"/> 普通推送
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="dictType" value="1" v-model="bMessageDict.dictType"/> 自动回复推送
                    </label>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">消息推送key</div>
                <div class="col-sm-10">
                    <input disabled type="text" class="form-control" v-model="bMessageDict.dictKey"
                           placeholder="消息推送key（#KEY#）"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">消息推送文本</div>
                <div class="col-sm-10">
                    <input type="text" class="form-control" v-model="bMessageDict.dictVal" placeholder="消息推送文字"/>
                </div>
            </div>
            <div v-show="bMessageDict.dictType == 0">
                <div class="form-group">
                    <div class="col-sm-2 control-label">消息推送链接</div>
                    <div class="col-sm-10">
                        <select id="dictLink" class="form-control" v-model="bMessageDict.dictLink">
                            <option value="-1" selected>消息推送链接</option>
                        </select>
                    </div>
                </div>
            </div>
            <div v-show="bMessageDict.dictType == 1">
                <div class="form-group">
                    <div class="col-sm-2 control-label">自动回复文字</div>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" v-model="bMessageDict.dictText"
                               placeholder="自动回复-文字"/>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">状态</div>
                <div class="col-sm-10">
                    <label class="radio-inline">
                        <input type="radio" name="deleteState" value="0" v-model="bMessageDict.status"/> 停用
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="deleteState" value="1" v-model="bMessageDict.status"/> 正常
                    </label>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">消息备注</div>
                <div class="col-sm-10">
                    <textarea cols="25" rows="10" class="form-control" v-model="bMessageDict.remark"
                              placeholder="备注"></textarea>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">创建者</div>
                <div class="col-sm-10">
                    <input disabled type="text" class="form-control" v-model="bMessageDict.createBy" placeholder="创建者"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">创建时间</div>
                <div class="col-sm-10">
                    <input disabled type="text" class="form-control" v-model="bMessageDict.createTime"
                           placeholder="创建时间"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">更新者</div>
                <div class="col-sm-10">
                    <input disabled type="text" class="form-control" v-model="bMessageDict.updateBy" placeholder="更新者"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label">更新时间</div>
                <div class="col-sm-10">
                    <input disabled type="text" class="form-control" v-model="bMessageDict.updateTime"
                           placeholder="更新时间"/>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
            </div>
        </form>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/sys/bmessagedict.js?_${.now?long}"></script>
<script type="text/javascript" charset="utf-8">
    // 公众号标识
    // $.ajax({
    //     type: "POST",
    //     async: false,
    //     url: baseURL + 'sys/buserinfo/getUserGzhList',
    //     contentType: "application/json",
    //     success: function (r) {
    //         if (r.code == 0) {
    //             for (var i = 0; i < r.userGzhList.length; i++) {
    //                 $("#gzhCode").append(
    //                     "<option value=" + r.userGzhList[i].gzhCode + ">" + r.userGzhList[i].gzhName + "</option>");
    //             }
    //         }
    //     }
    // });

    // 页面路径
    $.ajax({
        type: "POST",
        async: false,
        url: baseURL + 'sys/bmessagedict/queryBMessageLinkList',
        contentType: "application/json",
        success: function (r) {
            if (r.code == 0) {
                console.log(r.bMessageLinkList);
                for (var i = 0; i < r.bMessageLinkList.length; i++) {
                    $("#dictLink").append(
                        "<option value=" + r.bMessageLinkList[i].id + ">" + r.bMessageLinkList[i].linkName + "</option>");
                }
            }
        }
    });
</script>
</body>
</html>
